<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!DOCTYPE html>
<html lang="zh-cn">
    <head>
        <title>Hiring-企业后台</title>
        <%@ include file="/WEB-INF/view/common/import.jsp"%>
	    <style>
	    	.application {
	    		font-weight: bolder;
	    		font-size: 20px;
	    		margin-right: 10px;
	    	}
	    </style>
    </head>
    <body>
    	<div class="container">
    		<strong class="welcome-title">欢迎您，张三</strong>
    		<button type="button" class="btn btn-warning pull-right">注　　销</button>
    		<span class="pull-right">&nbsp;</span>
    		<button type="button" class="btn btn-warning pull-right">修改密码</button>
    		<span class="pull-right">&nbsp;</span>
    		<button type="button" class="btn btn-warning pull-right">基本信息</button>
	    	<hr/>

	    	<span class="application">应聘审核</span>
	    	<form action="<%=request.getContextPath()%>/ApplicationServlet?command=listApplication" method="post" id="searchForm">
	    		职位名称:<input type="text" name="positionName" value="${application.position$name }"/>
	    		状态：<select name="status">
	    				<option value="0" <c:if test="${application.status == 0 }">selected</c:if>>-全部-</option>
	    				<option value="1" <c:if test="${application.status == 1 }">selected</c:if>>待审核</option>
	    				<option value="2" <c:if test="${application.status == 2 }">selected</c:if>>已通过</option>
	    				<option value="3" <c:if test="${application.status == 3 }">selected</c:if>>已拒绝</option>
	    			</select>
	    		申请时间(起止)：
	    			<input type="text" name="appTimeStart" value="${application.appTimeStart}" id="d4311" class="Wdate" onFocus="WdatePicker({maxDate:'#F{$dp.$D(\'d4312\')||\'2020-10-01\'}',dateFmt:'yyyy-MM-dd HH:mm:ss'})"/>
		    		-
		    		<input type="text" name="appTimeEnd" value="${application.appTimeEnd}"  id="d4312" class="Wdate" onFocus="WdatePicker({minDate:'#F{$dp.$D(\'d4311\')}',maxDate:'2020-10-01',dateFmt:'yyyy-MM-dd HH:mm:ss'})"/>
	    		<button>查询</button>
	    	</form>
	    	<table class="table">
		      <thead>
		        <tr>
		          <th>序号</th>
		          <th>职位名称</th>
		          <th>求职者</th>
		          <th>简历</th>
		          <th>状态</th>
		          <th>申请时间</th>
		          <th>处理时间</th>
		          <th>操作</th>
		        </tr>
		      </thead>
		      <tbody>
		      	<c:forEach items="${pageModel.list }" var="application" varStatus="vs">
			      	<tr>
			          <td>${vs.count + (pageModel.pageNo - 1) * pageModel.pageSize}</td>
			          <td>${application.position$name }</td>
			          <td>${application.talent$name }</td>
			          <td>${application.resume$intention }</td>
			          <td>${application.statusStr }</td>
			          <td><fmt:formatDate value="${application.appTime }" pattern="yyyy-MM-dd HH:mm:ss"/></td>
			          <td>
			          	<c:if test="${! empty application.handleTime }">
			          		<fmt:formatDate value="${application.handleTime }" pattern="yyyy-MM-dd HH:mm:ss"/>
			          	</c:if>
			          </td>
			          <td><a href="">通过</a> <a href="">拒绝</a></td>
			        </tr>
		        </c:forEach>
		      </tbody>
		    </table>
	        <div class="pull-right">
	        	<button type="button" class="btn btn-default" onclick="go(${pageModel.first})" <c:if test="${pageModel.pageNo == pageModel.first }">disabled="disabled"</c:if>>首页</button>
	        	<button type="button" class="btn btn-default" onclick="go(${pageModel.pre})" <c:if test="${pageModel.pageNo == pageModel.first }">disabled="disabled"</c:if>>上一页</button>
	        	<select onchange="go(this.value)" class="select">
	        		<script>
	        			var totalPage = '${pageModel.totalPage }';
	        			var pageNo = '${pageModel.pageNo}'
	        			for (var i = 1; i <= totalPage; i++) {
	        				if (i == pageNo) {
	        				   document.write('<option value="'+ i +'" selected>第' + i +'页</option>');
	        				} else {
	        				   document.write('<option value="'+ i +'">第' + i +'页</option>');	
	        				}
	        			}
	        		</script>
	        	</select>
	        	<button type="button" class="btn btn-default" onclick="go(${pageModel.next})" <c:if test="${pageModel.pageNo == pageModel.last }">disabled="disabled"</c:if>>下一页</button>
	        	<button type="button" class="btn btn-default" onclick="go(${pageModel.last})" <c:if test="${pageModel.pageNo == pageModel.last }">disabled="disabled"</c:if>>尾页</button>
	        	&nbsp;&nbsp;&nbsp;&nbsp;
	        	当前第${pageModel.pageNo }页，
	        	显示${(pageModel.pageNo - 1) * pageModel.pageSize + 1}到第${(pageModel.pageNo - 1) * pageModel.pageSize + pageModel.pageSize}，共${pageModel.totalPage }页
	        </div>
    	</div>
    	<script src="<%=request.getContextPath()%>/static/common/vendor/My97DatePicker/WdatePicker.js"></script>
    	<script>
    		/**
    		 * 指定跳转到第几页
    		 */
    		var searchForm = $('#searchForm')[0];
    		function go(pageNo) {
    			searchForm.action = '<%=request.getContextPath()%>/ApplicationServlet?command=listApplication&pageNo=' + pageNo;
    			searchForm.submit();
    		}
    	</script>
    </body>
</html>
